﻿/* Filename: EnumeratedType.as 
 *
 * Description: This class allows for enumeration
 * of variables.
 *
 * Created By: Darron Schall
 *	(http://www.darronschall.com/weblog/archives/000097.cfm)
 * Modified By: Tyler Samson
 * Feb 2008
 * @ Sierra Nevada College
 */
class EnumeratedType {
	private var _top:Number;	// Keep track of top in order to add items later
 	
 	public function EnumeratedType() {
  		for (var i = 0; i < arguments.length; i++) {
   			// set up the identifier in the instance, and give
   			// it a numerical value, unique to the instance
   			this[arguments[i]] = i;
   			this[i] = [arguments[i]];
			this._top = i;
   		}
  	}
	
	public function push() {
  		for (var i = 0; i < arguments.length; i++) {
			var _next:Number = _top + 1 + i;
   			// set up the identifier in the instance, and give
   			// it a numerical value, unique to the instance
   			this[arguments[i]] = _next;
   			this[_next] = [arguments[i]];
			this._top = _next;
   		}
	}
}